<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" %>
<script>
$(function(){
  $("#monthlyproductSizedatagrid").datagrid({
      url:'${pageContext.request.contextPath}/sku/findByProductId?id=${param.id}',
      method:'get',
      fit:true,
      fitColumns:true,
      striped:true,
      remoteSort:false,
      checkOnSelect:false,
      toolbar:'#productMonthlySizetoolbar',
      onLoadSuccess:function(){
        $(".btn").linkbutton({
          plain:true
        })
      },
      columns:[[
        {field:'cks',checkbox:true},
        /*{title:'尺寸编号',field:'sizeid',align:'center'},*/
          {title:'sku编号',field:'skuId',align:'center'},
        {title:'尺寸',field:'size',align:'center'},
        {title:'胸围',field:'bust',align:'center'},
        {title:'腰围',field:'waist',align:'center'},
        {title:'臀围',field:'hipline',align:'center'},
        {title:'后衣长',field:'coatlength',align:'center'},
        {title:'库存',field:'number',align:'center'},
        {title:'颜色',field:'color',align:'center'},
        {title:'操作',field:'options',width:300,formatter:function(index,row,value){
          return "<a href='javascript:;' onclick=\"deleteSize('"+row.skuId+"')\"  class='btn' data-options=\"iconCls:'icon-remove'\">删除</a>"+
              "<a href='javascript:;' onclick=\"deleteSize('"+row.skuId+"')\"  class='btn' data-options=\"iconCls:'icon-remove'\">更新</a>"
        }}
      ]]
  })

});

//删除尺寸信息
function deleteSize(id){
  $.messager.confirm("删除提醒","确定要删除吗",function(r){
      if(r){
          $.post('${pageContext.request.contextPath}/sku/delete',{"id":id},function(result){
              showMessage(result.message);
              $("#monthlyproductSizedatagrid").datagrid('reload');
          })
      }
  })
}

    $("#btn").bind('click',function () {
        $("#uploadMonthlySize").form({
            url:'${pageContext.request.contextPath}/sku/save',
            success:function(){
                $("#monthlyproductSizedatagrid").datagrid('reload');
            }
        })
        $("#uploadMonthlySize").form('submit');
    })

    function openupdateDailySize(id){

    }
</script>

<div id="cc" class="easyui-layout" style="width:100%;height:100%;">
  <div data-options="region:'east',iconCls:'icon-reload',title:'新增尺寸信息',split:true" style="width:30%;">
    <form id="uploadMonthlySize" method="post" enctype="multipart/form-data" style="text-align: center;margin-top: 50px">
      <table align="center" style="margin-top: 50px">
        <tr>
          <td>
            <label>商品id:</label>
          </td>
          <td>
            <input class="easyui-textbox" type="text" name="id" data-options="required:true,value:'${param.id}'" readonly/>
          </td>
        </tr>
        <tr>
          <td>
            <label>尺寸:</label>
          </td>
          <td>
            <input class="easyui-textbox" type="text" name="size" data-options="required:true,value:'S'"/>
          </td>
        </tr>
        <tr>
          <td>
            <label>胸围</label>
          </td>
          <td>
            <input class="easyui-textbox" type="text" name="bust" data-options="required:true,value:'88'"/>
          </td>
        </tr>
        <tr>
          <td>
            <label>腰围</label>
          </td>
          <td>
            <input class="easyui-textbox" type="text" name="waist" data-options="required:true,value:'45'"/>
          </td>
        </tr>
        <tr>
          <td>
            <label>臀围</label>
          </td>
          <td>
            <input class="easyui-textbox" type="text" name="hipline" data-options="required:true,value:'76'"/>
          </td>
        </tr>
        <tr>
          <td>
            <label>后衣长</label>
          </td>
          <td>
            <input class="easyui-textbox" type="text" name="coatlength" data-options="required:true,value:'20'"/>
          </td>
        </tr>
        <tr>
          <td>
            <label>颜色</label>
          </td>
          <td>
            <input class="easyui-textbox" type="text" name="color" data-options="required:true,value:'黑色'"/>
          </td>
        </tr>
        <tr>
          <td>
            <label>库存</label>
          </td>
          <td>
            <input class="easyui-textbox" type="text" name="number" data-options="required:true,value:'100'"/>
          </td>
        </tr>

      </table>
      <br/>
      <a id="btn" href="javascript:;" class="easyui-linkbutton" data-options="iconCls:'icon-save'" style="margin-top: 20px">提交</a>
    </form>
  </div>



  <div data-options="region:'west',title:'展示所有关于该商品的尺寸信息',split:true" style="width:70%;">
    <table id="monthlyproductSizedatagrid" ></table>
  </div>
</div>



<div id="productMonthlySizetoolbar">
  <a href="javascript:;" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="deleteSome();">删除选中</a>
</div>